feat: support configurable Electron backend root - #153
Conversation
regnull
left a comment
There was a problem hiding this comment.
Changes requested.
-
BLOCKER —
backend/openbot/config.py:94-99: Root fallback detects whether overrides were explicit by comparing their parsed values to the defaults. This violates the stated “explicitWORKSPACE_ROOTandDATABASE_URLoverrides remain authoritative” contract whenever an explicit override equals the default (for exampleWORKSPACE_ROOT=./workspaceorDATABASE_URL=sqlite+aiosqlite:///./.openbot/openbot.db): the validator still replaces it with the supplied root. Use Pydantic's field-set/source information (or equivalent pre-validation) to distinguish omitted fields from explicitly supplied values, and add regression tests for both explicit-default cases. -
NIT —
Makefile:4:ELECTRON_ROOT_ARGSinterpolatesROOT_DIRECTORYunquoted. A root path containing spaces is split into multiple positional arguments, soelectron-dev.shforwards only the first word as the root. Please either preserve argument boundaries (or document/reject such paths) and add a forwarding test if this option is intended to support normal filesystem paths.
— Reviewer - @Reviewer
regnull
left a comment
There was a problem hiding this comment.
Ready to merge: PR #153 has addressed the previously identified configuration override and Makefile argument-boundary issues. The updated diff preserves explicitly supplied WORKSPACE_ROOT/DATABASE_URL (including values equal to defaults), forwards root paths safely through development and packaged startup, and adds regression coverage. CI is green at the reviewed head f543d7206ec17b96ff4eb9287a038bd790c25425.
— Reviewer - @Reviewer
regnull
left a comment
There was a problem hiding this comment.
Ready to merge.\n\nRe-reviewed the exact head 63dca69. The cancellation race fix snapshots the task reference before the null check and cancels that stable reference; root-directory propagation, explicit override preservation, quoting, and regression coverage remain correct. CI is green.\n\n— Reviewer - @Reviewer
Summary
WORKSPACE_ROOTandDATABASE_URLoverrides and existing no-root behavior.Problem
Electron callers need to select the application/project root at launch, but backend defaults were tied to the process working directory or Electron user-data conventions. The launcher had no way to forward a caller-selected root.
Solution
openbot.cliaccepts--root-directoryand exposes it to settings asOPENBOT_ROOT_DIRECTORY.Settingsapplies the root only when workspace/database values remain at their defaults:<root><root>/.openbot/openbot.dbROOT_DIRECTORY=/path make electron.Files changed
backend/openbot/cli.pybackend/openbot/config.pybackend/tests/test_config.pyscripts/electron-dev.shscripts/electron-backend.shfrontend/electron/main.cjsfrontend/electron/main.test.tsMakefileROOT_DIRECTORYforwarding for Electron.Validation
make lint(Ruff, Oxlint, client-boundary check): passed; existing Oxlint warnings only.make test: passed (460 backend tests, frontend tests, typecheck).make build: passed.Design notes
Explicit environment configuration remains authoritative. The root is a defaulting mechanism rather than a forced rewrite, so browser/development startup without a root and custom database/workspace deployments remain unchanged.